class Permission {
  static readonly READ = 0b00001;
  static readonly WRITE = 0b00010;
  static readonly SHARE = 0b00100;
  static readonly DELETE = 0b01000;
  static readonly CREATE = 0b10000;

  static include(permission: number, target: number) {
    return (permission & target) === target;
  }

  static add(permission: number, target: number) {
    return permission | target;
  }

  static remove(permission: number, target: number) {
    return permission & ~target;
  }

  static toggle(permission: number, target: number) {
    return permission ^ target;
  }
}

export default Permission;
